package com.caregiver.watch.business.care.model.vo;

import com.caregiver.watch.business.user.model.po.UserCareRecipient;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDate;

/**
 * @Description: 被照护人
 * @Author 疆戟
 * @Date 2025/8/30 13:56
 * @Version 1.0
 */
@Data
@Schema(description = "被照护人")
public class CareRecipientVo {

    /**
     * 被照护人ID
     */
    @Schema(description = "被照护人ID")
    private Long recipientId;

    /**
     * 被照护人姓名
     */
    @Schema(description = "被照护人姓名")
    private String name;

    /**
     * 与用户关系（本人、父亲、母亲、配偶等）
     */
    @Schema(description = "与用户关系（本人、父亲、母亲、配偶等）")
    private String relationship;

    /**
     * 联系电话
     */
    @Schema(description = "联系电话")
    private String phoneNumber;

    /**
     * 性别（0-未知 1-男 2-女）
     */
    @Schema(description = "性别（0-未知 1-男 2-女）")
    private Integer gender;

    /**
     * 出生日期
     */
    @Schema(description = "出生日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private LocalDate birthday;

    /**
     * 腕围
     */
    @Schema(description = "腕围")
    private Integer wristCircumference;

    /**
     * 身高
     */
    @Schema(description = "身高")
    private Integer height;

    /**
     * 体重
     */
    @Schema(description = "体重")
    private Integer weight;

    /**
     * 头像URL
     */
    @Schema(description = "头像URL")
    private String avatarUrl;


    public static CareRecipientVo build(UserCareRecipient userCareRecipient) {
        CareRecipientVo careRecipientVo = new CareRecipientVo();
        careRecipientVo.setRecipientId(userCareRecipient.getRecipientId());
        careRecipientVo.setName(userCareRecipient.getName());
        careRecipientVo.setRelationship(userCareRecipient.getRelationship());
        careRecipientVo.setPhoneNumber(userCareRecipient.getPhoneNumber());
        careRecipientVo.setGender(userCareRecipient.getGender());
        careRecipientVo.setBirthday(userCareRecipient.getBirthday());
        careRecipientVo.setWristCircumference(userCareRecipient.getWristCircumference());
        careRecipientVo.setHeight(userCareRecipient.getHeight());
        careRecipientVo.setWeight(userCareRecipient.getWeight());
        careRecipientVo.setAvatarUrl(userCareRecipient.getAvatarUrl());
        return careRecipientVo;
    }
}
